package org.bsc.myfirstapp.server;

import static org.bsc.myfirstapp.server.DatabaseUtils.getConnection;
import static org.bsc.myfirstapp.server.DatabaseUtils.releaseConnection;
import static org.bsc.myfirstapp.server.LogUtils.logger;

import java.sql.Connection;
import java.sql.SQLException;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;


public class Bootstrapper implements ServletContextListener {

	public void contextDestroyed(ServletContextEvent event) {
        logger.debug( "contextDestroyed");
		
	}

	public void contextInitialized(ServletContextEvent event) {
        logger.debug( "contextInitialized");
		
		Connection conn = null;
		try {
			conn = getConnection();
		} catch (SQLException e) {
                    logger.error( "error opening db connection", e);
                }
		finally {
			releaseConnection(conn);
		}
	}


}
